# -*- coding:utf-8 -*-
# @Project:
# @File:
# @Date:
# @Author:Joe
# @Description:获取json数据文件路径，并返回json数据

import sys
import os
import json


def get_data(syyname):
    # 获取当前文件的目录路径
    current_dir = os.path.dirname(__file__)
    if 'try_syy_allinone' in current_dir:
        parent_dir = current_dir
    else:
        # 获取上一级目录路径
        parent_dir = os.path.dirname(current_dir)
    # 将上级目录添加到系统路径
    sys.path.append(parent_dir)
    # 配置文件路径+文件名
    json_file_path = os.path.join(parent_dir, 'data_json', f'私有云{syyname}.json')
    with open(json_file_path, 'r', encoding='utf-8') as f:
        data = json.load(f)
    return data
